<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>AngluarJS集合数据遍历</title>
		<script type="text/javascript" src="../js/angular.min.js"></script>
	</head>
	<!--ng-app s是angular 编程入口,是模块作用域  -->
	<body >
		<div ng-app="myapp" ng-controller="myctrl">
			<table width="100%" border="1px">
				<tr>
					<th>序号</th>
					<th>商品编号</th>	
					<th>商品名称</th>
					<th>价格</th>
				</tr>
				<tr ng-repeat="product in products">
					<td>{{$index+1}}</td>
					<td>{{product.id}}</td>
					<td>{{product.name}}</td>
					<td>{{product.price }}</td>
				</tr>
			</table>			
		</div>
	<script type="text/javascript">
		//1.定义模块
		var  myapp = angular.module("myapp",[]);
		//2.设置控制器
		myapp.controller("myctrl", ["$scope", function($scope) {
			//捆绑一个集合  注意:这里数据是采用json的数据格式
			$scope.products = [{
				id: 1001,
				name: '数码相机',
				price: 3000
			}, {
				id: 1002,
				name: '苹果手机',
				price: 5000
			}];
		}])</script>
	</body>
</html>
